package com.qiye.pointsserver.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qiye.pointsserver.common.PageUtil.PageParam;
import com.qiye.pointsserver.common.PageUtil.PageResult;
import com.qiye.pointsserver.model.dto.AutherDto;
import com.qiye.pointsserver.model.dto.ProductDto;
import com.qiye.pointsserver.model.entity.Auther;
import com.qiye.pointsserver.model.entity.Product;
import com.qiye.pointsserver.service.ProductService;
import com.qiye.pointsserver.mapper.ProductMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author Lenovo
* @description 针对表【sys_product(产品积分表)】的数据库操作Service实现
* @createDate 2025-07-09 16:52:01
*/
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
    implements ProductService{

    @Resource
    private ProductMapper productMapper;

    @Override
    public PageResult<Product> searchProduct(PageParam pageParam) {
        Page<Product> page = new Page<>(pageParam.getPageNum(), pageParam.getPageSize());
        IPage<Product> resultPage = productMapper.searchPage(page, pageParam.getKeyword());
        return new PageResult<>(resultPage);
    }

    @Override
    public List<ProductDto> search() {
        List<ProductDto> autherDtoList = productMapper.search();
        return autherDtoList;
    }

}




